package com.ys.everydaynews.ui.main.presenter

import android.util.Log
import com.ys.everydaynews.http.HttpUtils
import com.ys.everydaynews.http.ResponseListener
import com.ys.everydaynews.http.UserApi
import com.ys.everydaynews.mvp.model.BaseModel
import com.ys.everydaynews.mvp.presenter.BasePresenter
import com.ys.everydaynews.ui.main.model.ShopDatasModel
import com.ys.everydaynews.ui.main.view.MainView

class MainPresenter : BasePresenter<MainView>() {
  fun getTest(){
     HttpUtils.sendHttp(HttpUtils.createApi(UserApi::class.java).getShopDatas(1),object :ResponseListener<BaseModel<ShopDatasModel>>{
         override fun onSuccess(data: BaseModel<ShopDatasModel>) {
             if (data!=null){
                 getBaseView()!!.setData(data)
             }
         }

         override fun onFail(err: String) {
             getBaseView()!!.setError(err)
         }

     })
  }
}